package com.cgbl.cg.adapter

import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.utils.pic.ImageLoaderUtils
import com.youth.banner.Banner
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder
import com.youth.banner.indicator.RectangleIndicator

class HomeFollowAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.app_item_home_follow) {
    override fun convert(holder: BaseViewHolder, item: String) {
        val banner = holder.getView<Banner<Int, BannerImageAdapter<Int>>>(R.id.item_banner)
        banner.setAdapter(object : BannerImageAdapter<Int>(
            arrayListOf(
                R.mipmap.app_bg_banner,
                R.mipmap.app_bg_banner,
                R.mipmap.app_bg_banner
            )
        ) {
            override fun onBindView(
                holder: BannerImageHolder?,
                data: Int?,
                position: Int,
                size: Int
            ) {
                ImageLoaderUtils.getGlideManager()
                    .load(data)
                    .into(holder?.imageView!!)
            }
        })
        banner.setIndicator(holder.getView<RectangleIndicator>(R.id.indicator), false)

        ImageLoaderUtils.displayCirclePortrait(context, holder.getView(R.id.item_iv_avatar), R.mipmap.app_ic_qq)
    }
}